A cannabinoid is a generic name referring to marijuana components contained in Cannabis sativa, about 60 kinds or more thereof are known so far, and typical examples thereof include tetrahydrocannabinol, cannabinol, cannabidiol, and the like. Marijuana has been used in pharmaceuticals or the like for thousands of years, and it shows a neuropsychiatric response and causes sensory confusion, euphoria, analgesic action, hallucination, or the like. Cannabinoids have a great variety of pharmacological actions, and have been found to have an immunosuppressive action, an anti-inflammatory action, an analgesic action, or the like, in addition to the actions in the central nervous system.
A cannabinoid receptor is a 7-transmembrane G protein-coupled receptor, and two types thereof, a cannabinoid type 1 receptor (CB1) and a cannabinoid type 2 receptor (CB2), have been hitherto identified and screened (Nature, 1990, 346, 561-564; and Nature, 1993, 365, 61-65). Human CB1 consists of 472 amino acids, and is significantly expressed in the globus pallidus, striatum, substantia nigra, hippocampus, stratum moleculare of cerebellum, cerebral cortex, or the like in the brain. Besides the expression in the brain, it is also expressed in the testis, vas deferens, uterus, small intestine, blood vessels, or the like. CB2 consists of 360 amino acids, has a homology of 44% to CB1, and is significantly expressed in the spleen, tonsils, and lymph nodes, and also in leukocyte cells such as macrophages, monocytes, B lymphocytes, NK cells, eosinophils, and the like. Recently, CB2 has also been reported to be expressed in the brain (Science, 2005, 310, 329-332).
A CB2 agonist has been reported to exhibit a central analgesic action (European Journal of Neuroscience, 2006, 23, 1530-1538) and a peripheral analgesic action (Proceedings of the National Academy of Sciences, 2005, 102, 3093-3098). Also, a CB2 agonist has been reported to exhibit an immunosuppressive action and an anti-inflammatory action since CB2 is significantly expressed in the hematopoietic cells and immune cells (British Journal of Pharmacology, 2003, 139, 775-786). It has been reported that a CB2 agonist has an anti-pruritic action in skin diseases (Science, 2007, 316, 1494-1497), and is expected to be applied to atopic dermatitis or the like. In addition, a CB2 agonist can be expected to be effective in atherosclerosis (Nature, 2005, 434, 782-786), reflux esophagitis (European Journal of Pharmacology, 2007, 573, 206-213), liver disorders (British Journal of Pharmacology, 2008, 153, 286-289), and chronic liver diseases (Expert Opinion of Therapeutic Targets, 2007, 11, 403-409), due to its anti-inflammatory action and immunosuppressive action. Furthermore, CB2 is also expressed in osteoblasts and osteoclasts, and a CB2 agonist has been reported to have an action of inhibiting bone destruction through an action of increasing the osteoblasts and an action of inhibiting the activity of the osteoclasts (Proceedings of the National Academy of Sciences, 2006, 103, 696-701).
As CB2 agonistic compounds, a pyridine derivative (Patent Documents 1 to 4), an indole derivative (Patent Document 5), a pyrrolopyridine derivative (Patent Document 6), an α-pinene derivative (Patent Document 7), an imidazopyridine derivative (Patent Document 8), a pyrrolopyridine derivative (Patent Document 9), a pyrrolopyrazine derivative (Patent Document 10), an imidazopyrimidine derivative (Patent Document 11), and the like have been reported. In addition, as a pyrimidine derivative, the following compounds have been reported. Patent Documents 12 to 15 show that a compound of the formula (A) has a CB2 agonistic activity and Patent Document 16 shows that a compound of the formula (B) has a CB2 agonistic activity. However, there is no disclosure of the compounds described in the present application.
(In the formula, Y represents phenyl which may have a substituent. For the other symbols, refer to the publications.)

Further, the following pyrimidine compound has been known.
Patent Documents 17 and 18, and Non-Patent Document 1 show that a compound of the formula (C) is useful in inflammation. However, these documents have neither disclosure of a CB2-related activity nor disclosure of the compound described in the present application.
(For the symbols in the formula, refer to the publications.)

Patent Document 19 shows that a compound of the formula (D) is useful for pain. However, this document has neither disclosure of a CB2-related activity nor disclosure of the compound described in the present application.
(For the symbols in the formula, refer to the publication.)

Patent Documents 20 to 22 describe that a compound of the formula (E), characterized in that the substituent R2 is hydrazine, is useful for inflammation. However, these documents have neither disclosure of a CB2-related activity nor disclosure of the compound described in the present application.
(For the symbols in the formula, refer to the publications.)

Patent Document 23 describes that a compound of the formula (F) can be a ligand selective to a dopamine D3 receptor. However, this document has neither disclosure of a CB2-related activity nor disclosure of the compound described in the present application.
(For the symbols in the formula, refer to the publication.)

A compound of the formula (G) is commercially available from Aurora Fine Chemicals Ltd., and the like.

A compound of the formula (H) is a known compound (Registry Number: 1026643-33-3).

In documents relating to synthetic organic chemistry, pyrimidine derivatives are disclosed (Non-Patent Document 2 and Non-Patent Document 3).